<?php

namespace Cck\ArticlesSystem\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class HtmlTagUpdateRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $id = $this->route('html_tag')->id;

        return [
            'name' => 'required|max:50',
            'tag' => [
                'required',
                'max:100',
                Rule::unique('html_tags', 'tag')->ignore($id)
            ],
            'html' => 'string|required'
        ];
    }
}
